<template>
    <div>
        <el-table stripe border v-loading="loading" :data="dataList" >
            <el-table-column label="时间" prop="createTime" min-width="" :show-overflow-tooltip="true"/>
            <el-table-column label="结算金额(元)" prop="changeAmount" :show-overflow-tooltip="true"/>
            <el-table-column label="账户类型" prop="" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.accountType | accountProfitTypeFM}}
                </template>
            </el-table-column>
            <el-table-column label="业务类型" prop="changeType" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{dictTranslate(scope.row.changeType, dicts.ACCOUNT_CHANGE_TYPE)}}
                </template>
            </el-table-column>
            <el-table-column label="操作类型" prop="changeStatus" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.changeStatus | accountChangeStatusFM}}
                </template>
            </el-table-column>
            <el-table-column label="操作后账户余额（元）" prop="afterAvailableBalance" :show-overflow-tooltip="true"/>
            <el-table-column label="备注" prop="remark" :show-overflow-tooltip="true"/>
        </el-table>
        <Pagination v-show="total > 0" :total="total" :page.sync="pageNo" :limit.sync="pageSize" @pagination="getList"/>
    </div>
</template>

<script>
    import {ProfitManage} from '@/api';
    import { mapState } from 'vuex'
    export default {
        name: "ToolBar",
        props: {
            dicts: {
                type: Object,
                default: function () {
                    return {}
                }
            },
            queryParams: {
                type: Object,
                default: function () {
                    return {}
                }
            }
        },
        computed:{
            ...mapState('app', ['userInfo']),
            isOrg(){
                return this.userInfo.org
            },
        },
        data() {
            return {
                pageNo: 1,
                pageSize: 10,
                loading: false,
                total: 0,
                dataList: [],
                selectRow: {},
                showCustomForm: false,
                isAdd: false,
                allCount:'',
            }
        },
        watch: {
            queryParams: function () {
                this.pageNo = 1;
                this.getList();
            },
        },
        methods: {
            async getList() {
                this.loading = true;
                let result = await ProfitManage.agentAccountDetail.list(this.pageNo, this.pageSize, this.queryParams);
                this.loading = false;
                this.total = result.count || 0;
                this.dataList = result.data || [];
            },
            handlerCustomFormOnclose() {
                this.showCustomForm = false;
                this.getList();
            },
            async handleUpdate(row) {
                this.showCustomForm = true;
                this.selectRow = row;
                this.isAdd = false;
            },
        }
    };
</script>

<style scoped>

</style>
